package com.my.chapter11;

import java.util.ArrayList;

public class practice1 {
    public static void main(String[] args) {
        ArrayList<Gerbil> gerbils= new ArrayList<Gerbil>();
        for(int i=0;i<7;i++){
            gerbils.add(new Gerbil(i));
        }
        for(Gerbil g:gerbils){
            g.hop();
        }
    }
}

class Gerbil{
    int gerbilNumber;
    public Gerbil(int gerbilNumber){
        this.gerbilNumber = gerbilNumber;
    }

    void hop(){
        System.out.println("Gerbil" + gerbilNumber + " is hoping");
    }
}
